import type { AxiosProgressEvent } from 'axios'

// 请求配置
export interface RequestConfig {
  url?: string
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
  data?: any
  params?: any
  headers?: Record<string, string>
  timeout?: number
  withCredentials?: boolean
  responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'
  onUploadProgress?: (progressEvent: AxiosProgressEvent) => void // ✅ 新增这一行
}

// 响应结构
export interface ResponseData<T> {
  code?: number
  message?: string
  data:T,
  success?: boolean
}

// 错误信息
export interface ApiError {
  code: number
  message: string
  data?: any
}

// 分页请求参数
export interface PaginationParams {
  page: number
  pageSize: number
}

// 分页响应数据
export interface PaginationResponse<T = any> {
  list: T[]
  total: number
  page: number
  pageSize: number
}

// 上传进度回调
export interface UploadProgressCallback {
  (progress: number): void
}